#include"Processbar.h"

double bandwidth = 1024*1024*1.0;

void download(double filesize,callback_t cb)
{
  double current = 0.0;

    printf("download begin, current: %lf\n", current);
    while(current <= filesize)
    {
        cb(filesize, current);
        //从网络中获取数据
        usleep(100000);
        current += bandwidth;
    }
    printf("\ndownload done, filesize: %lf\n",filesize);  
}

int main()
{
  Procbar_1();
  download(100*1024*1024,Procbar_2);
  return 0;
}
